<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="../js/tools.js"></script>
    <script>

        // 产生一个随机数，判断是不是质数
        var n = rand(2, 100);
        var res = isZhi(n);
        document.write(n + ' ' + res);



        // 5位随机验证码
        var res = '';
        for (var i = 0; i < 5; i++) {
            res += rand(0, 10);
        }
        document.write('<br>' + res + '<br>');


        // 100以内的质数   8个换行
        !function () {
            for (var i = 2, count = 0; i < 100; i++) {
                // var res = isZhi(i);
                // if (res) {
                //     count++;
                //     document.write(i + ' ');
                //     if (count % 8 === 0) {
                //         document.write('<br>')
                //     }
                // }

                if (isZhi(i)) {
                    count++;
                    document.write(i + ' ');
                    if (count % 8 === 0) {
                        document.write('<br>')
                    }
                }
            }

        }()

        document.write('<br>');

        // 产生随机数判断是不是质数
        document.write(isZhi(rand(2, 100)));

    </script>

</body>

</html>